import 'package:car_map/widget/load_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

///药店
class PharmacyPage extends StatefulWidget {
  @override
  _pharmacyState createState() => _pharmacyState();
}

class _pharmacyState extends State<PharmacyPage> {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text('药店'),
      ),
      body:
      Container(
        child:
        GridView.builder(
          shrinkWrap: true,
          physics: new NeverScrollableScrollPhysics(),
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
            //横轴元素个数
              crossAxisCount:4,
              //纵轴间距
              mainAxisSpacing: 20.0,
              //横轴间距
              crossAxisSpacing: 5.0,
              //子组件宽高长度比例
              childAspectRatio: 1.0),
          itemBuilder: (context,index){
            return itemGrvide();
          },
          itemCount: 4,
        )
//        ListView.builder(itemBuilder: (context,index){
//          return itemGrvide();
//        },itemCount: 4,scrollDirection: Axis.horizontal,) ,
      ),
    );
  }

  Widget itemGrvide() {
    return Container(
      margin: EdgeInsets.all(10.0),
        height: ScreenUtil().setHeight(300.0),
      child: Stack(
        overflow: Overflow.visible,
        children: <Widget>[
          Container(
            width: ScreenUtil().setWidth(400.0),
            height: ScreenUtil().setHeight(300.0),
            color: Colors.blue,
          ),
          Positioned(
            top: -10.0,
              child: Container(
            child: Icon(Icons.cloud),
          ))
        ],
      ),
    );
  }
}
